/*
* Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved.
* Description  :Component description file about platform efuse.
* Author : Huawei
* Create : 2023/04/12
*/

#ifndef __PLAT_EFUSE_H__
#define __PLAT_EFUSE_H__

#define PLAT_TOTEM_DIE_ID_TOTAL         23
#define PLAT_NIMBUS_DIE_ID_TOTAL        64
#define PLAT_NIMBUS_S_DIE_ID_TOTAL      17

#define PLAT_EFUSE_1620CS_VERISON_0     0
#define PLAT_EFUSE_1620_S_VERISON_0     1

#define PLAT_EFUSE_VERSION              PLAT_EFUSE_1620_VERISON_0

#if (PLAT_EFUSE_VERSION == PLAT_EFUSE_1620CS_VERISON_0)
    #define PLAT_EFUSE_CHIP_TOTAL           1721
    #define PLAT_EFUSE_INFO_COLUMN          41
    #define PLAT_EFUSE_CLUSTER_TOTAL        16

    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER0_CH0    9
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER1_CH0    10
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER2_CH0    11
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER3_CH0    12
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER4_CH0    13
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER5_CH0    14
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER6_CH0    15
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER7_CH0    16
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER0_CH1    17
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER1_CH1    18
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER2_CH1    19
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER3_CH1    20
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER4_CH1    21
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER5_CH1    22
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER6_CH1    23
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER7_CH1    24

#elif (PLAT_EFUSE_VERSION == PLAT_EFUSE_1620_S_VERISON_0)
    #define PLAT_EFUSE_CHIP_TOTAL           1743
    #define PLAT_EFUSE_INFO_COLUMN          25
    #define PLAT_EFUSE_CLUSTER_TOTAL        8


    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER0_CH0    9
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER1_CH0    10
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER2_CH0    11
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER3_CH0    12
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER4_CH0    13
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER5_CH0    14
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER6_CH0    15
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER7_CH0    16
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER0_CH1    17
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER1_CH1    18
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER2_CH1    19
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER3_CH1    20
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER4_CH1    21
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER5_CH1    22
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER6_CH1    23
    #define PLAT_EFUSE_TABLE_INDEX_TA_CLUSTER7_CH1    24

#endif

typedef union totem_die_id0 {
    // Define the struct bits
    struct {
        unsigned int dieid_std_ver          : 3;        // [2..0]
        unsigned int mr_flag                : 1;        // [3]
        unsigned int ltidsum_27_0           : 28;       // [31..4]
    } bits;

    unsigned int value;
} totem_die_id0_t;

typedef union totem_die_id1 {
    // Define the struct bits
    struct {
        unsigned int ltidsum_35_28          : 8;        // [7..0]       [39..32]
        unsigned int waferid                : 5;        // [12..8]      [44..40]
        unsigned int die_x                  : 8;        // [20..13]     [52..45]
        unsigned int die_y                  : 8;        // [28..21]     [60..53]
        unsigned int passflag_rt_cp         : 1;        // [29]         [61]
        unsigned int failflag_all           : 2;        // [31..30]     [63..62]
    } bits;

    unsigned int value;
} totem_die_id1_t;

typedef union totem_die_id2 {
    // Define the struct bits
    struct {
        unsigned int year                   : 6;        // [5..0]       [69..64]
        unsigned int mon                    : 4;        // [9..6]       [73..70]
        unsigned int day                    : 5;        // [14..10]     [78..74]
        unsigned int hour                   : 5;        // [19..15]     [83..79]
        unsigned int min                    : 6;        // [25..20]     [89..84]
        unsigned int sec                    : 6;        // [31..26]     [95..90]
    } bits;

    unsigned int value;
} totem_die_id2_t;

typedef union totem_die_id3 {
    // Define the struct bits
    struct {
        unsigned int ipaddrsum              : 32;       // [31..0]       [127..96]
    } bits;

    unsigned int value;
} totem_die_id3_t;

typedef union totem_die_id4 {
    // Define the struct bits
    struct {
        unsigned int passflag_rt_ft         : 1;        // [0]          [128]
        unsigned int passflag_ht_ft         : 1;        // [1]          [129]
        unsigned int burnin_flag            : 1;        // [2]          [130]
        unsigned int passflag_rt_bi_ft      : 1;        // [3]          [131]
        unsigned int passflag_ht_bi_ft      : 1;        // [4]          [132]
        unsigned int site_num_ft            : 4;        // [8..5]       [136..133]
        unsigned int ec_ver                 : 3;        // [11..9]      [139..137]
        unsigned int pkg_info               : 4;        // [15..12]     [143..140]
        unsigned int img_ver                : 4;        // [19..16]     [147..144]
        unsigned int passflag_lt_cp         : 1;        // [20]         [148]
        unsigned int project_efuse_map_ver  : 3;        // [23..21]     [151..149]
        unsigned int crc8_cp_dieid          : 8;        // [31..24]     [159..152]
    } bits;

    unsigned int value;
} totem_die_id4_t;

typedef union totem_die_id5 {
    // Define the struct bits
    struct {
        unsigned int slt_ver                : 8;        // [7..0]       [167..160]
        unsigned int cp_ver                 : 8;        // [15..8]      [175..168]
        unsigned int ft_ver                 : 8;        // [23..16]     [183..176]
        unsigned int foundry_id             : 4;        // [27..24]     [187..184]
        unsigned int chip_loc_3_0           : 4;        // [31..28]     [191..188]
    } bits;

    unsigned int value;
} totem_die_id5_t;

typedef union totem_die_id6 {
    // Define the struct bits
    struct {
        unsigned int chip_loc_36_4          : 32;       // [31..0]      [223..192]
    } bits;

    unsigned int value;
} totem_die_id6_t;

typedef union totem_die_id7 {
    // Define the struct bits
    struct {
        unsigned int chip_loc_59_37         : 24;       // [23..0]      [247..224]
        unsigned int passflag_rt_ftb        : 1;        // [24]         [248]
        unsigned int passflag_rt_bi_ftb     : 1;        // [25]         [249]
        unsigned int passflag_ht_ftb        : 1;        // [26]         [250]
        unsigned int passflag_ht_bi_ftb     : 1;        // [27]         [251]
        unsigned int passflag_rt_ftc        : 1;        // [28]         [252]
        unsigned int passflag_rt_bi_ftc     : 1;        // [29]         [253]
        unsigned int passflag_ht_ftc        : 1;        // [30]         [254]
        unsigned int passflag_ht_bi_ftc     : 1;        // [31]         [255]
    } bits;

    unsigned int value;
} totem_die_id7_t;

typedef union totem_die_id8 {
    // Define the struct bits
    struct {
        unsigned int ht_iddq                : 19;       // [18..0]      [274..256]
        unsigned int nt_iddq_12_0           : 13;       // [31..19]     [287..275]
    } bits;

    unsigned int value;
} totem_die_id8_t;

typedef union totem_die_id9 {
    // Define the struct bits
    struct {
        unsigned int nt_iddq_16_13          : 4;        // [3..0]       [291..288]
        unsigned int speed_grade            : 4;        // [7..4]       [295..292]
        unsigned int bb_layers              : 4;        // [11..8]      [299..296]
        unsigned int pkg_mode               : 4;        // [15..12]     [303..300]
        unsigned int power_grade            : 8;        // [23..16]     [311..304]
        unsigned int tr5_avs_id_7_0         : 8;        // [31..24]     [319..312]
    } bits;

    unsigned int value;
} totem_die_id9_t;

typedef union totem_die_id10 {
    // Define the struct bits
    struct {
        unsigned int tr5_avs_id_19_8        : 12;       // [11..0]      [331..320]
        unsigned int tsensor0_trim_19_0     : 20;       // [31..12]     [351..332]
    } bits;

    unsigned int value;
} totem_die_id10_t;

typedef union totem_die_id11 {
    // Define the struct bits
    struct {
        unsigned int tsensor0_trim_21_20    : 2;        // [1..0]       [353..352]
        unsigned int tsensor1_trim_21_0     : 22;       // [23..2]      [375..354]
        unsigned int ddr_2933_flag          : 1;        // [24]         [376]
        unsigned int ddr_2933_flag_ht       : 1;        // [25]         [377]
        unsigned int reserved               : 6;        // [31..26]     [383..378]
    } bits;

    unsigned int value;
} totem_die_id11_t;

typedef union totem_die_id12 {
    // Define the struct bits
    struct {
        unsigned int reserved               : 32;       // [31..0]      [415..384]
    } bits;

    unsigned int value;
} totem_die_id12_t;

typedef union totem_die_id13 {
    // Define the struct bits
    struct {
        unsigned int core_test_flag         : 32;       // [31..0]      [447..416]
    } bits;

    unsigned int value;
} totem_die_id13_t;

typedef union totem_die_id14 {
    // Define the struct bits
    struct {
        unsigned int l3d_mem_grp_test_flag  : 20;      // [19..0]      [467..448]
        unsigned int pg_pd_flag             : 8;       // [27..20]     [475..468]
        unsigned int pg_pd_sel              : 1;       // [28]         [476]
        unsigned int reserved               : 3;       // [31..29]     [479..477]
    } bits;

    unsigned int value;
} totem_die_id14_t;

typedef union totem_die_id15 {
    // Define the struct bits
    struct {
        unsigned int dvs                    : 2;       // [1..0]        [481..480]
        unsigned int reserved               : 30;      // [31..2]       [511..482]
    } bits;

    unsigned int value;
} totem_die_id15_t;

typedef union totem_die_id16 {
    // Define the struct bits
    struct {
        unsigned int reserved               : 32;      // [31..0]       [543..512]
    } bits;

    unsigned int value;
} totem_die_id16_t;

typedef union totem_die_id17 {
    // Define the struct bits
    struct {
        unsigned int avs_domain_num         : 4;        // [3..0]       [547..544]
        unsigned int avs_stage_bit          : 8;        // [11..4]      [555..548]
        unsigned int avs0_vmin_valid        : 2;        // [13..12]     [557..556]
        unsigned int avs0_rcc_valid         : 2;        // [15..14]     [559..558]
        unsigned int avs0_valid             : 2;        // [17..16]     [561..560]
        unsigned int avs0_hpm_num           : 4;        // [21..18]     [565..562]
        unsigned int avs0_hpm0_1st_9_0      : 10;       // [31..22]     [575..566]
    } bits;

    unsigned int value;
} totem_die_id17_t;

typedef union totem_die_id18 {
    // Define the struct bits
    struct {
        unsigned int avs0_hpm0_1st_19_10    : 10;       // [9..0]       [585..576]
        unsigned int avs0_hpm1_1st          : 20;       // [29..10]     [605..586]
        unsigned int avs0_hpm2_1st_1_0      : 2;        // [31..30]     [607..606]
    } bits;

    unsigned int value;
} totem_die_id18_t;

typedef union totem_die_id19 {
    // Define the struct bits
    struct {
        unsigned int avs0_hpm2_1st_19_2     : 18;       // [17..0]      [625..608]
        unsigned int avs0_hpm3_1st_13_0     : 14;       // [31..18]     [639..626]
    } bits;

    unsigned int value;
} totem_die_id19_t;

typedef union totem_die_id20 {
    // Define the struct bits
    struct {
        unsigned int avs0_hpm3_1st_19_14    : 6;        // [5..0]       [645..640]
        unsigned int avs0_hpm4_1st          : 20;       // [25..6]      [665..646]
        unsigned int avs0_hpm5_1st_5_0      : 6;        // [31..26]     [671..666]
    } bits;

    unsigned int value;
} totem_die_id20_t;

typedef union totem_die_id21 {
    // Define the struct bits
    struct {
        unsigned int avs0_hpm5_1st_19_6     : 14;       // [13..0]      [685..673]
        unsigned int avs0_hpm6_1st_17_0     : 18;       // [31..14]     [703..686]
    } bits;

    unsigned int value;
} totem_die_id21_t;

typedef union totem_die_id22 {
    // Define the struct bits
    struct {
        unsigned int avs0_hpm6_1st_19_18    : 2;        // [1..0]       [705..704]
        unsigned int avs0_hpm7_1st          : 20;       // [21..2]      [725..706]
        unsigned int avs0_hpm0_2nd_9_0      : 10;       // [31..22]     [735..726]
    } bits;

    unsigned int value;
} totem_die_id22_t;

typedef union totem_die_id {
    struct {
        totem_die_id0_t die_id0;
        totem_die_id1_t die_id1;
        totem_die_id2_t die_id2;
        totem_die_id3_t die_id3;
        totem_die_id4_t die_id4;
        totem_die_id5_t die_id5;
        totem_die_id6_t die_id6;
        totem_die_id7_t die_id7;
        totem_die_id8_t die_id8;
        totem_die_id9_t die_id9;
        totem_die_id10_t die_id10;
        totem_die_id11_t die_id11;
        totem_die_id12_t die_id12;
        totem_die_id13_t die_id13;
        totem_die_id14_t die_id14;
        totem_die_id15_t die_id15;
        totem_die_id16_t die_id16;
        totem_die_id17_t die_id17;
        totem_die_id18_t die_id18;
        totem_die_id19_t die_id19;
        totem_die_id20_t die_id20;
        totem_die_id21_t die_id21;
        totem_die_id22_t die_id22;
    } die_id_bits;

    unsigned int die_id[PLAT_TOTEM_DIE_ID_TOTAL];
} totem_die_id_t;
#endif

